pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let (num, from_base) = num_str.strip_suffix(')').unwrap().split_once('(').unwrap();
    let from_base = from_base.parse().unwrap();
    let mut num = u32::from_str_radix(num, from_base).unwrap();

    let mut ans = Vec::new();
    while num > 0 {
        fn to_char(digit: u8) -> u8 {
            if digit < 10 {
                digit + b'0'
            } else {
                digit + b'a' - 10
            }
        }

        ans.push(to_char((num % to_base) as _));
        num /= to_base;
    }

    if ans.is_empty() {
        "0".into()
    } else {
        ans.reverse();
        String::from_utf8(ans).unwrap()
    }
}
